import validation from './index';

describe('UtilsValidation', () => {
    test('isEmail should validate email correctly', () => {
        expect(validation.isEmail('test@example.com')).toBe(true);
        expect(validation.isEmail('invalid-email')).toBe(false);
        expect(validation.isEmail('test@')).toBe(false);
    });

    test('isPhoneNumber should validate phone number correctly', () => {
        expect(validation.isPhoneNumber('13812345678')).toBe(true);
        expect(validation.isPhoneNumber('12345678901')).toBe(false);
        expect(validation.isPhoneNumber('1381234567')).toBe(false);
    });

    test('isIdCard should validate ID card correctly', () => {
        expect(validation.isIdCard('123456789012345678')).toBe(true);
        expect(validation.isIdCard('12345678901234567X')).toBe(true);
        expect(validation.isIdCard('123456789012345')).toBe(true);
        expect(validation.isIdCard('1234567890')).toBe(false);
    });

    test('isStrongPassword should validate strong password correctly', () => {
        expect(validation.isStrongPassword('Password123!')).toBe(true);
        expect(validation.isStrongPassword('password')).toBe(false);
        expect(validation.isStrongPassword('PASSWORD')).toBe(false);
        expect(validation.isStrongPassword('Pass123')).toBe(false);
    });

    test('isURL should validate URL correctly', () => {
        expect(validation.isURL('https://www.example.com')).toBe(true);
        expect(validation.isURL('http://example.com')).toBe(true);
        expect(validation.isURL('ftp://files.example.com')).toBe(true);
        expect(validation.isURL('invalid-url')).toBe(false);
    });
});